package VIEW;

import CONF.ConexaoOracle;
import MODEL.PessoaModel;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.GregorianCalendar;
import javax.swing.JOptionPane;

public class CadastraPessoaView extends javax.swing.JFrame {
    private Integer     tabelaAssociacaoLinha;
    private PessoaModel pessoa;
    private String      lineUp;
    private Boolean     cadastroEfetuado;

    /**
     * Creates new form CadastraPessoaView
     */
    public CadastraPessoaView() {
        
    }
    
    public CadastraPessoaView(Integer tabelaAssociacaoLinha,
            PessoaModel pessoa,
            String lineUp) {
        initComponents();
        this.tabelaAssociacaoLinha = tabelaAssociacaoLinha;
        this.pessoa                = pessoa;
        this.lineUp                = lineUp;
        campoCpf.setText(pessoa.getCpf().toString());
        campoNome.setText("");
        campoNascimento.setText("");
        campoRua.setText("");
        campoNumero.setText("");
        campoCidade.setText("");
        campoCep.setText("");
        campoTelefone.setText("");
        campoCelular.setText("");
        cadastroEfetuado = false;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton2 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        campoCpf = new javax.swing.JTextField();
        campoNome = new javax.swing.JTextField();
        campoNascimento = new javax.swing.JTextField();
        campoRua = new javax.swing.JTextField();
        campoNumero = new javax.swing.JTextField();
        campoCidade = new javax.swing.JTextField();
        campoCep = new javax.swing.JTextField();
        campoTelefone = new javax.swing.JTextField();
        campoCelular = new javax.swing.JTextField();
        botaoCadastrar = new javax.swing.JButton();
        labelCPF = new javax.swing.JLabel();
        labelNome = new javax.swing.JLabel();
        labelDataNascimento = new javax.swing.JLabel();
        labelRua = new javax.swing.JLabel();
        labelNumero = new javax.swing.JLabel();
        labelCidade = new javax.swing.JLabel();
        labelCep = new javax.swing.JLabel();
        labelTelefone = new javax.swing.JLabel();
        labelCelular = new javax.swing.JLabel();

        jButton2.setText("jButton2");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Rock In Rio - Cadastro de Pessoa");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                closingHandler(evt);
            }
        });

        campoCpf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCpfActionPerformed(evt);
            }
        });
        campoCpf.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoCpfFocusLost(evt);
            }
        });

        campoNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNomeActionPerformed(evt);
            }
        });
        campoNome.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoNomeFocusLost(evt);
            }
        });

        campoNascimento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNascimentoActionPerformed(evt);
            }
        });
        campoNascimento.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoNascimentoFocusLost(evt);
            }
        });

        campoRua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoRuaActionPerformed(evt);
            }
        });
        campoRua.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoRuaFocusLost(evt);
            }
        });

        campoNumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNumeroActionPerformed(evt);
            }
        });
        campoNumero.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoNumeroFocusLost(evt);
            }
        });

        campoCidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCidadeActionPerformed(evt);
            }
        });
        campoCidade.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoCidadeFocusLost(evt);
            }
        });

        campoCep.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCepActionPerformed(evt);
            }
        });
        campoCep.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoCepFocusLost(evt);
            }
        });

        campoTelefone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoTelefoneActionPerformed(evt);
            }
        });
        campoTelefone.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoTelefoneFocusLost(evt);
            }
        });

        campoCelular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCelularActionPerformed(evt);
            }
        });
        campoCelular.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoCelularFocusLost(evt);
            }
        });

        botaoCadastrar.setText("Cadastrar");
        botaoCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoCadastrarActionPerformed(evt);
            }
        });

        labelCPF.setText("CPF*");

        labelNome.setText("Nome*");

        labelDataNascimento.setText("Data de Nascimento*");

        labelRua.setText("Rua*");

        labelNumero.setText("Número*");

        labelCidade.setText("Cidade*");

        labelCep.setText("CEP*");

        labelTelefone.setText("Telefone");

        labelCelular.setText("Celular*");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labelCPF)
                    .addComponent(labelNome)
                    .addComponent(labelDataNascimento)
                    .addComponent(labelRua)
                    .addComponent(labelNumero)
                    .addComponent(labelCidade)
                    .addComponent(labelCep)
                    .addComponent(labelTelefone)
                    .addComponent(labelCelular))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(botaoCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCep, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoRua, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoNome, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCpf, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelCPF))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelNome))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelDataNascimento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelRua))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelNumero))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelCidade))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoCep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelCep))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelTelefone))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelCelular))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botaoCadastrar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        campoNome.getAccessibleContext().setAccessibleName("");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botaoCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoCadastrarActionPerformed
        Integer cpf            = 0;
        Integer cep            = 0;
        Integer telefone       = 0;
        Integer celular        = 0;
        Boolean dadosValidos   = true;
        GregorianCalendar data = new GregorianCalendar();
        
        // testando se os campos obrigatórios foram preenchidos
        if (campoNome.getText().equals("") ||
                campoNascimento.getText().equals("") ||
                campoRua.getText().equals("") || 
                campoNumero.getText().equals("") || 
                campoCidade.getText().equals("") || 
                campoCep.getText().equals("") || 
                campoCelular.getText().equals("")) {
            dadosValidos = false;
            JOptionPane.showMessageDialog(null, "Os campos com * são de"
                    + " preenchimento obrigatório!");
        }
        
        // testando se o cpf contém apenas números
        try{
            cpf      = Integer.parseInt(campoCpf.getText());
            cep      = Integer.parseInt(campoCep.getText());
            if (!campoTelefone.getText().equals("")) {
                telefone = Integer.parseInt(campoTelefone.getText());    
            }
            celular  = Integer.parseInt(campoCelular.getText());
        } catch (NumberFormatException e){
            dadosValidos = false;
            JOptionPane.showMessageDialog(null, "CPF, CEP, Telefone e Celular"
                    + " composto apenas por números!");
            return;
        } finally {
            pessoa.setCpf(cpf);
            pessoa.setCEP(cep);
            if (!campoTelefone.getText().equals("")) {
                pessoa.setTelefone(telefone);
            }
            pessoa.setCelular(celular);
        }
        
        // testando se a data pode ser inserida
        try{
            data = pessoa.dataStringToCalendar(campoNascimento.getText());
        } catch (ParseException ex) {
            dadosValidos = false;
            JOptionPane.showMessageDialog(null, "Data inválida, o formato correto "
                    + "é dd/mm/aaaa. Exemplo: 26/01/1985.");
            return;
        } finally {
            pessoa.setDataNascimento(data);
        }
        
        // efetuando gravação dos dados
        try{
            pessoa.setNome(campoNome.getText());
            pessoa.setRua(campoRua.getText());
            pessoa.setNumero(campoNumero.getText());
            pessoa.setCidade(campoCidade.getText());
            pessoa.setTipoPessoa("ESP");
            pessoa.cadastrarPessoaDB(ConexaoOracle.conexao);
            cadastroEfetuado = true;
            AssociarIngressosView.data[tabelaAssociacaoLinha][1] = cpf;

        } catch (SQLException ex) {
            dadosValidos = false;
            JOptionPane.showMessageDialog(null, "Erro ao gravar no banco de dados."
                    + " Tente novamente conferindo se os dados estão corretos.");
        } finally {
            pessoa.setCpf(cpf);
        }        

        if (dadosValidos) {
            this.dispose();              
        }        
    }//GEN-LAST:event_botaoCadastrarActionPerformed

    private void closingHandler(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closingHandler
        CadastraPessoaView frame = (CadastraPessoaView)evt.getSource();
        
        if (!cadastroEfetuado) {
            int result = JOptionPane.showConfirmDialog(
                frame,
                "Você não efetuou o cadastro do CPF informado. Caso não "
                + "efetue o cadastro será necessário inserir um novo cpf. "
                + "Deseja realmente sair?",
                "Sair",
                JOptionPane.YES_NO_OPTION);
        
            if (result == JOptionPane.YES_OPTION && cadastroEfetuado != true) {
                AssociarIngressosView.jTable1.setValueAt(0, this.tabelaAssociacaoLinha, 1);
                frame.setDefaultCloseOperation(CadastraPessoaView.DISPOSE_ON_CLOSE);
            } else if (cadastroEfetuado = true) {
                frame.setDefaultCloseOperation(CadastraPessoaView.DISPOSE_ON_CLOSE);
            } else {
                frame.setDefaultCloseOperation(CadastraPessoaView.DO_NOTHING_ON_CLOSE);
            }
        }
    }//GEN-LAST:event_closingHandler

    private void campoCpfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCpfActionPerformed

    }//GEN-LAST:event_campoCpfActionPerformed

    private void campoCpfFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoCpfFocusLost
        Integer cpf = 0;
        try {
            cpf = Integer.parseInt(campoCpf.getText());
        } catch (NumberFormatException e){
            //System.out.println(e.getMessage());
            campoCpf.setText("0");
            JOptionPane.showMessageDialog(null, "CPF composto apenas por números!");
        } finally {
            pessoa.setCpf(cpf);
        }
        try {
            pessoa.verificaPessoaDB(ConexaoOracle.conexao, lineUp);
        } catch (SQLException ex) {
            //System.out.println(ex.getMessage());
        } finally {
            if (pessoa.pessoaExiste() == 1) {
                JOptionPane.showMessageDialog(null, "CPF já cadastrado! Esta pessoa não poderá ser cadastrada novamente!");
            }
        }        
    }//GEN-LAST:event_campoCpfFocusLost

    private void campoNomeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoNomeFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNomeFocusLost

    private void campoNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNomeActionPerformed

    private void campoNascimentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNascimentoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNascimentoActionPerformed

    private void campoNascimentoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoNascimentoFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNascimentoFocusLost

    private void campoRuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoRuaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoRuaActionPerformed

    private void campoRuaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoRuaFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoRuaFocusLost

    private void campoNumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNumeroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNumeroActionPerformed

    private void campoNumeroFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoNumeroFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNumeroFocusLost

    private void campoCidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCidadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCidadeActionPerformed

    private void campoCidadeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoCidadeFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCidadeFocusLost

    private void campoCepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCepActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCepActionPerformed

    private void campoCepFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoCepFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCepFocusLost

    private void campoTelefoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoTelefoneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoTelefoneActionPerformed

    private void campoTelefoneFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoTelefoneFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoTelefoneFocusLost

    private void campoCelularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCelularActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCelularActionPerformed

    private void campoCelularFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoCelularFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCelularFocusLost

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CadastraPessoaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CadastraPessoaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CadastraPessoaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastraPessoaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CadastraPessoaView().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoCadastrar;
    private javax.swing.JTextField campoCelular;
    private javax.swing.JTextField campoCep;
    private javax.swing.JTextField campoCidade;
    private javax.swing.JTextField campoCpf;
    private javax.swing.JTextField campoNascimento;
    private javax.swing.JTextField campoNome;
    private javax.swing.JTextField campoNumero;
    private javax.swing.JTextField campoRua;
    private javax.swing.JTextField campoTelefone;
    private javax.swing.JButton jButton2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel labelCPF;
    private javax.swing.JLabel labelCelular;
    private javax.swing.JLabel labelCep;
    private javax.swing.JLabel labelCidade;
    private javax.swing.JLabel labelDataNascimento;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelNumero;
    private javax.swing.JLabel labelRua;
    private javax.swing.JLabel labelTelefone;
    // End of variables declaration//GEN-END:variables
}
